#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
/*num*a*2=limit*b*2*/

int main() {

	int n;
	int nLimit=0;
	cin>>n;
	vector<int> vecArr(n);
	for(int i=0;i<n;++i){
		cin>>vecArr[i];
		while(vecArr[i]%2==0){
			vecArr[i]/=2;
		}
	}
	bool flg=true;
	for(int i=1;i<n;++i){
		if(vecArr[i]!=vecArr[i-1]){
			flg=false;
			break;
		}
	}
	
	if(flg){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}
	
	return 0;
}
